package org.deschutter.hibernate;

import javax.persistence.Column;
import javax.persistence.Id;
import java.io.Serializable;

/**
 * User: Berten De Schutter
 * Date: 01-Oct-2009
 * Time: 13:38:21
 */
public class GalaxiesPK implements Serializable {
    private int x;

    @Column(name = "x")
    @Id
    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    private int y;

    @Column(name = "y")
    @Id
    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        GalaxiesPK that = (GalaxiesPK) o;

        if (x != that.x) return false;
        if (y != that.y) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = x;
        result = 31 * result + y;
        return result;
    }
}
